<?php
header("Content-Type: application/vnd.ms-excel");
header('Content-Disposition: attachment; filename="subscribe.xls"');
?>

<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
    <head>
        <meta http-equiv="Content-type" content="text/html;charset=utf-8" />
    </head>
    <body>
        <table  x:str style="border:1px solid #000000;">
            <thead>
                <tr>
                    <th style="border:1px solid #000000;">No.</th>
                    <th style="border:1px solid #000000;">Name</th>
                    <th style="border:1px solid #000000;">Email</th>
                    <th style="border:1px solid #000000;">Confirm</th>
                </tr>
            </thead>
            <tbody>
                <?php
                    $i = 1;
                    foreach($list as $val){
                        $conf = $val->active==1 ? 'Yes' : 'No';
                        echo <<<EOF
                            <tr>
                                <td style="border:1px solid #000000;text-align:center;padding:2px 5 px;">{$i}</td>
                                <td style="border:1px solid #000000;padding:2px 5 px;">{$val->name}</td>
                                <td style="border:1px solid #000000;padding:2px 5 px;">{$val->email}</td>
                                <td style="border:1px solid #000000;text-align:center;padding:2px 5 px;">{$conf}</td>
                            </tr>
EOF;
                        $i++;
                    }
                ?>
            </tbody>
        </table>
    </body>
</html>